#include<iostream>
using namespace std;
class Stu
{
	public:
		void Input(int,double);
		double getMax();
		void Output();
	private:
		int ID;
		double Grade;
};
void Stu::Input(int id,double grade)
{
	this->ID=id;
	this->Grade=grade;
}
double Stu::getMax()
{
	return this->Grade;
}
void Stu::Output()
{
	cout<<"ID:"<<this->ID<<" "<<"Grade:"<<this->Grade<<endl;
}
int main()
{
	Stu a[10];
	int n;
	cin>>n;
	if(n>10)
	{
		cout<<"error"<<endl;
		return 0;
	}
	for(int i=0;i<n;i++)
	{
		int id;
		double grade;
		cin>>id>>grade;
		a[i].Input(id,grade);
	}
	int max=0,maxone;
	for(int i=0;i<n;i++)
	{
		if(a[i].getMax()>max)
		{
			maxone=i;
			max=a[i].getMax();
		}
	}
	a[maxone].Output();
	return 0;
}
